﻿using System.ComponentModel;
using System.Linq;
using Microsoft.AspNetCore.Mvc;
using Jack.DataScience.Http.Jwt;
using Vav.Api.Utils;
using Vav.Api.GenericDtos;
using Vav.Data.TransferTypes;
using Newtonsoft.Json;
using Vav.Data.Models;
using Vav.Data.DataAccess;
using System;
using Vav.Api.Authorization;
using System.Threading.Tasks;
using System.IO;
using Vav.Data.WeChat;

namespace Vav.Api
{
    [Route("api/qq")]
    public class QQController : BaseController
    {
        private readonly QQDataAccess   qQDataAccess;
        public QQController(QQDataAccess qQDataAccess)
        {
            this.qQDataAccess = qQDataAccess;
        }
        [Route("getaccess_token")]
        [HttpGet]
        public async Task<ActionResult<ApiBaseModel>> GetAccessToken(string appid)
        {
            if (string.IsNullOrWhiteSpace(appid))
            {
                return ApiFail("参数错误");
            }
            var data = await qQDataAccess.GetAccessToken(appid);
            if (string.IsNullOrWhiteSpace(data))
            {
                return ApiFail("获取access_token失败");
            }
            return ApiSuccess(data, "success");
        }
    }
}
